#! /usr/bin/env/ python
# -*- encoding: utf-8 -*-

'''
autor: Luis Franco e Ricardo Cabecinha
CPS 2012
Date: 06-02-2012
This program creates N pseudo-random numbers

Virtual Box - Virtual Machine: Linux Mint 11 2.6.38-8-generic

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Core(TM)2 Duo CPU     T6600  @ 2.20GHz
stepping	: 10
cpu MHz		: 2108.307
cache size	: 6144 KB
address sizes	: 36 bits physical, 48 bits virtual

note: the execution time have been taken including output time
output: N[k] = randomized_number

Execution times python code: (see ../python/pseudoRandom.py
10		Numbers: Code time 0.0100 seconds
100		Numbers: Code time 0.0000 seconds
1000	Numbers: Code time 0.0300 seconds
10000	Numbers: Code time 0.2500 seconds
100000 	Numbers: Code time 2.1600 seconds
1000000	Numbers: Code time 22.4400 seconds

Execution times, this time calling c:
10		Numbers: Code time 0.0000 seconds
100		Numbers: Code time 0.0000 seconds
1000	Numbers: Code time 0.0100 seconds
10000	Numbers: Code time 0.1000 seconds
100000 	Numbers: Code time 1.0000 seconds
1000000	Numbers: Code time 9.1000 seconds
'''

import random
import time
import middle


'''
Exception for user input invalid number
'''
while True:
	try:
		nIter = int(raw_input("Enter the number of Random numbers: "))
		break
	except ValueError:
		print "Oops! That was no valid number! Try again..."
	pass

t1 = time.clock()

result = middle.randomFromC(nIter)

t2 = time.clock()

#print "Exec time =", (t2-t1)
print 'Code time %.4f seconds' % (t2 - t1)


